package com.blue;

import com.blue.pojo.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        // 获取 Spring 容器
        ApplicationContext application = new ClassPathXmlApplicationContext("spring.xml");

        // 根据 Bean 的 ID 从 Spring 容器中获取这个对象
        User user = (User) application.getBean("userBean");
        System.out.println(user);

        // 启动 log4j 记录日志
        Logger logger = LoggerFactory.getLogger(Main.class);
        logger.info("我是一条消息");
        logger.debug("我是一条调试消息");
        logger.error("我是一条错误消息");
    }
}
